'''
Created on 14/05/2010

@author: Mar
'''
from IOResource import IOResource

class ResourceManager:
    
    def __init__(self):
        self.resources = {}   
                  
    def distribute(self, aPCB):
        resource = self.resources[aPCB.getCurrentInstructionType()]
        resource.put(aPCB)

    def registerResource(self, resourceName, numberOfResources, readyQueue, outputQueue):
        resource = IOResource(resourceName, numberOfResources, readyQueue, outputQueue)
        self.resources[resourceName] = resource

    def startUp(self):
        for resource in self.resources.values():
            resource.startUp()
        